﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>修改字段名</title>
    <!--link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/easyUI145/jquery.min.js"></script>
    <script src="../../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" /-->
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Comm/Gener.js" type="text/javascript"></script>
    <script src="../../../Portal/js/vue/vue.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <style>
        .pull-right{ float:right;text-align:right}
        .cur {
            cursor: pointer
        }
        .Kclass{ border:0px; color:#ff6a00; padding:3px 5px; width:80%}
        .Kclass:focus{ border-bottom:1px solid #ff6a00;padding:2px 4px 3px;}
    </style>
    <script type="text/javascript">
        var frmID = "";
        //页面启动函数.
        $(function () {

            InitBar("KeyOfEn");

            frmID = GetQueryString("FrmID");

            //所有的字段.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_Batch");
            handler.AddPara("FrmID", frmID);
            var data = handler.DoMethodReturnJSON("KeyOfEn_Init");

            console.log(data);

            //返回的列请参考：BatchFieldName_Init

            //字段分组.
            var gfs = new Entities("BP.Sys.GroupFields");
            gfs.Retrieve("FrmID", frmID, "Idx");
            //生成列表.

        });

        //保存方法.
        function Save() {

        }
        //单行的保存。
        function SaveOne(oldName, newName) {
            if (oldName == newName)
                return "";

            var en = new Entities("BP.Sys.FrmUI.MapAttrString", frmID + "_" + oldName);

            var data = en.DoMethodReturnString("DoRenameField", newName);

            return data;
        }

    </script>
</head>
<body>
    <div class="container-fluid" id="KeyEn" style=" margin:15px 0px;">
        <div class="row" style=" margin:0px 0px 15px;">
            <div class="col-sm-6"> <button @click.stop="Save()" class="btns btn-primary">保存</button></div>
            <div class="col-sm-4 pull-right"><div id="bar"></div></div>
        </div>
   
    <div class="KeyEn" >
        <table class="table">
            <tr>
                <th>Idx</th>
                <th>名称</th>
                <th>字段类型</th>
                <th>字段名</th>
                <th>建议名称1</th>
                <th>建议名称2</th>
                <th>修改名称</th>
            </tr>
            <tr v-for="(item,index) in list">
                <td>{{index+1}}</td>
                <td>{{item.Name}}</td>
                <td>{{item.DBType}}</td>
                <td>{{item.KeyOfEn}}</td>
                <td><span @click.stop="EditName(index,item.JianPin)" class="cur">{{item.JianPin}}</span></td>
                <td><span @click.stop="EditName(index,item.QuanPin)" class="cur">{{item.QuanPin}}</span></td>
                <td><input class="Kclass" v-model="item.Ename" @blur="WirteName(index,$event)" /></td>

            </tr>
        </table>
       
    </div>
    </div>
    <script>
        var editPK = '';
        new Vue({
            el: '#KeyEn',
            data: {
                list: [],
            },
            methods: {
                EditName: function (e, EName) {
                    var EList = this.list
                    EList[e].Ename = EName                   
                },
                WirteName: function (i,e) {
                    var WList = this.list
                    WList[i].Ename = e.target.value
                    
                },
                Save: function () {
                    console.log(this.list)
                }
            },
            mounted: function () {
                InitBar("KeyOfEn");

                frmID = GetQueryString("FrmID");

                //所有的字段.
                var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_Batch");
                handler.AddPara("FrmID", frmID);
                var data = handler.DoMethodReturnJSON("KeyOfEn_Init");
                for (d = 0; d < data.length; d++) {
                    var de = data[d]
                  
                    de.Ename = ''
                }
                this.list = data;
                
                
            }

        });

    </script>
</body>
</html>
